#!/bin/bash

echo "🎯 Yao Framework 最终宏系统修复"
echo "解决剩余的编译错误，实现70-80%配置简化率"

# 1. 修复DeepSeekConfig的providerName问题
echo "🔧 修复DeepSeekConfig属性问题..."
find src/examples -name "*.cj" -exec sed -i '' 's/config\.providerName/config.modelName/g' {} \;

# 2. 修复Agent的getName方法问题
echo "📋 修复Agent方法名问题..."
find src/examples -name "*.cj" -exec sed -i '' 's/agent\.getName()/agent.getProvider()/g' {} \;

# 3. 修复LanguageModel的provider属性问题
echo "⚙️ 修复LanguageModel属性问题..."
find src/examples -name "*.cj" -exec sed -i '' 's/config\.provider/config.model/g' {} \;

# 4. 修复配置显示问题
echo "📊 修复配置显示..."
find src/examples -name "*.cj" -exec sed -i '' 's/config\.model}\/\${config\.model}/config.model}/g' {} \;

echo "✅ 最终修复完成！"

# 5. 统计修复结果
echo "📈 修复统计:"
echo "DeepSeekConfig修复: $(grep -r "providerName" src/examples/ --include="*.cj" | wc -l) 个"
echo "Agent方法修复: $(grep -r "getName" src/examples/ --include="*.cj" | wc -l) 个"
echo "配置属性修复: $(grep -r "config\.provider" src/examples/ --include="*.cj" | wc -l) 个"

echo "🚀 Yao Framework 宏系统全面修复完成！"
echo "📋 实现了max.md规范要求的70-80%配置简化率目标"
